var reverseBetween = function (head, m, n) {
  let dummy = new ListNode(0);
  dummy.next = head;
  let temp = dummy;
  // 找到第 m - 1 个链表节点
  for (let i = 0; i < m - 1; i++) {
    temp = temp.next;
  }
  // 206 题解法一
  let prev = null;
  let curr = temp.next;
  for (let i = 0; i <= n - m; i++) {
    let next = curr.next;
    curr.next = prev;
    prev = curr;
    curr = next;
  }
  // 将翻转的部分链表和原链表拼接
  temp.next.next = curr;
  temp.next = prev;
  return dummy.next;
};
